// pages/wo/wo.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    phoneNumber:"",
    avatarUrl: "",
    nickName: "",

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    const user = wx.getStorageSync("we_userInfo");
    var phone;
    if(user.user.phone){
      phone = user.user.phone
    }else{
      phone = "请先注册"
    }
    //console.log(app.globalData.userInfo)
    that.setData({
      avatarUrl: app.globalData.userInfo.avatarUrl,
      nickName: app.globalData.userInfo.nickName,
      phoneNumber: phone
    })
  },

  cell_click:function(e){
    //console.log(e)
    var cellId = e.currentTarget.dataset.id;
    if(cellId == "0"){
      wx.navigateTo({
        url: '../oldOrder/oldOrder',
      })
    }
    if(cellId == "1"){
      wx.navigateTo({
        url: '../adress/adress?type=3',
      })
    }

    if(cellId == "2"){
      //联系客服
      wx.makePhoneCall({
        phoneNumber: "0818-2808789",
        success: function (e) {
          console.log('拨打电话成功')
        },
        fail: function (e) {
          console.log('拨打电话失败')
          console.log(e.errMsg)
        }
      })
    }
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})